package cn.yangliu.tools;

import cn.yangliu.bean.LinkInfo;

import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Constans {

    public static LinkInfo linkInfo;

    public static Properties config;

    public static final ExecutorService POOL = Executors.newFixedThreadPool(10);

    public static final Properties mysql_mapping;

    public static final Map<String,String> custome_mapping = new ConcurrentHashMap<>();

    static {
        config = new Properties();
        mysql_mapping = new Properties();
        try (InputStream is = Constans.class.getClassLoader().getResourceAsStream("config.properties");
             InputStream is2 = Constans.class.getClassLoader().getResourceAsStream("mysql-mapping.properties");) {
            config.load(is);
            mysql_mapping.load(is2);
        } catch (IOException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}
